package Pool;

import java.util.concurrent.LinkedBlockingQueue;

public class Productor implements Runnable {
    private LinkedBlockingQueue<BaoZi> zt;

    public Productor(LinkedBlockingQueue<BaoZi> zt) {
        this.zt = zt;
    }

    @Override
    public void run() {
        int i=0;
        while (i<10){
            i++;
            BaoZi bz=new BaoZi("包子"+i);
            try {
                zt.put(bz);
                System.out.println(Thread.currentThread().getName()+"生产了"+bz);
                Thread.sleep(50);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
